<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Queries\ArticleQuery;
use App\Http\Resources\ArticleResource;
class ArticleController extends Controller
{
    public function index(ArticleQuery $query,Request $request){
        return ArticleResource::collection($query->select("title",
            "description","type","created_at","updated_at")->paginate());
    }

    public function show(int $article_id,ArticleQuery $query){
        $article = $query->findOrFail($article_id);
        return new ArticleResource($article);
    }
}
